/*
 * @Descripttion: 
 * @version: 
 * @Author: Zuo
 * @Date: 2021-09-30 14:48:39
 * @LastEditors: Zuo
 * @LastEditTime: 2021-10-09 09:29:32
 */
import NProgress from '../utils/NProgress'
import  router  from "./index";
router.beforeEach((to, from, next) => {
  NProgress.start()
  const token = sessionStorage.getItem("token");
  if (!token && to.path !== "/login") {
    next("/login");
  } else if (to.matched.length === 0) {
    next("/404");
  } else {
    next();
  }
});

router.afterEach((to,from)=>{
  NProgress.done()
})
